<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
  <title>教师列表</title>
  <!-- 引入CSS和JS资源 -->
</head>
<body>
<h1>教师列表</h1>
<form th:action="@{/teacher/listTeacher}" method="get">
  <input type="text" name="tname" placeholder="搜索老师名" />
  <button type="submit">搜索</button>
</form>
<table>
  <thead>
  <tr>
    <th>教师号</th>
    <th>姓名</th>
    <th>性别</th>
    <th>课程号</th>
    <th>系</th>
    <th>操作</th>
  </tr>
  </thead>
  <tbody>
  <tr th:each="teacher : ${teachers}">
    <td th:text="${teacher.tno}">教师号</td>
    <td th:text="${teacher.tname}">姓名</td>
    <td th:text="${teacher.tsex}">性别</td>
    <td th:text="${teacher.cno}">课程号</td>
    <td th:text="${teacher.tdept}">系</td>
    <td>
      <a th:href="@{/teacher/preUpdateTeacher/{tno}(tno=${teacher.tno})}">编辑</a>
      <a th:href="@{/teacher/delTeacher/{tno}(tno=${teacher.tno})}">删除</a>
    </td>
  </tr>
  </tbody>
</table>
<!-- 添加新课程表单 -->
<h2>添加教师</h2>
<form th:action="@{/teacher/saveTeacher}" method="post" >
  <!-- 课程编号，假设是必填项且为文本输入 -->
  <label for="tno">教师号</label>
  <input type="text" id="tno" name="tno" required><br>

  <!-- 课程名称，假设是必填项且为文本输入 -->
  <label for="tname">姓名</label>
  <input type="text" id="tname" name="tname" required><br>

  <!-- 课程时间，假设是整数输入，可以是选填项 -->
  <label for="tsex">性别</label>
  <input type="text" id="tsex" name="tsex"><br>

  <!-- 课程学分，假设是整数输入，可以是选填项 -->
  <label for="cno">课程号</label>
  <select id="cno" name="cno">
    <option th:each="course : ${courseList}" th:value="${course.cno}" th:text="${course.cno}"></option>
  </select><br>
  <label for="tdept">系</label>
  <input type="text" id="tdept" name="tdept"><br>
  <!-- 提交按钮 -->
  <input type="submit" value="提交">
</form>
</body>
</html>